# $Id: PKGBUILD 82006 2013-01-05 16:07:45Z fyan $
# Maintainer: Felix Yan <felixonmars@gmail.com>

pkgbase=ydcv
pkgname=('ydcv' 'ydcv-python2')
pkgver=0.3.2
pkgrel=2
arch=("any")
url="https://github.com/felixonmars/ydcv"
license=("GPL")
source=("https://github.com/felixonmars/$pkgbase/archive/$pkgver.tar.gz")

package_ydcv() {
  pkgdesc="YouDao Console Version - Simple wrapper for Youdao online translate (Chinese <-> English) service API, as an alternative to the StarDict Console Version(sdcv)"
  depends=("python3")
  install -Dm755 "${srcdir}/$pkgbase-$pkgver/$pkgbase.py" "${pkgdir}/usr/bin/$pkgbase"
}

package_ydcv-python2() {
  pkgdesc="YouDao Console Version - Simple wrapper for Youdao online translate (Chinese <-> English) service API, as an alternative to the StarDict Console Version(sdcv) - Python2 version"
  depends=("python2")
  provides=('ydcv')
  conflicts=('ydcv')

  cp "${srcdir}/$pkgbase-$pkgver/$pkgbase.py" "${srcdir}/$pkgbase-$pkgver/$pkgbase-python2.py"
  sed -i -e "s|#!/usr/bin/env python$|#!/usr/bin/env python2|" "${srcdir}/$pkgbase-$pkgver/$pkgbase-python2.py"

  install -Dm755 "${srcdir}/$pkgbase-$pkgver/$pkgbase-python2.py" "${pkgdir}/usr/bin/$pkgbase"
}

# vim:set ts=2 sw=2 et:
md5sums=('e95296b92f56b43fa5382bd9418956db')
